/**
 * Author xiaol
 * Rev
 * Date: 2021-03-23 21:58
 * <p>
 * Copyright (C) 2021 Seeyon, Inc. All rights reserved.
 * <p>
 * This software is the proprietary information of Seeyon, Inc.
 * Use is subject to license terms.
 * @company seeyon.com
 * @author xiaol
 */
package com.lagou;

import com.lagou.annotate.Scan;
import com.lagou.bean.AbstractApplicationContext;
import com.lagou.bean.AnnotateBeanApplicaitonContext;
import com.lagou.scan.PackageScanManager;
import com.lagou.scan.PackageScanManagerImpl;

import java.io.IOException;
import java.util.Map;

/**
 * @description
 * @date 2021-03-23 21:58
 * @author xiaol
 */
public class SpringApplicationBoot {

	/**
	 * 启动Ioc容器
	 */
	static void main(Class clazz) throws IOException, ClassNotFoundException {
		Scan scan = (Scan) clazz.getAnnotation(Scan.class);
		if(scan != null){
			PackageScanManager scanManager = new PackageScanManagerImpl();
			Map<String, Class> map = scanManager.scan(scan.value());
			AbstractApplicationContext applicationContext = new AnnotateBeanApplicaitonContext(map);
			applicationContext.createBean();
		}
	}
}
